package de.tuhh.simsearch.dto;

import java.io.Serializable;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

import de.tuhh.simsearch.util.PreferenceTuple;

/**
 * The UserDTO is the data transfer object for user entities. The dto is converted into an entity in the backend. The
 * dto contains only the information which is safe to hand to the client. The dto contains the name, the list of the
 * names of joined, created and requested group, the set of PreferenceTuples which contains name and content type of
 * preferences of the user.
 * 
 * @author SimSearch 1
 * 
 * @see PreferenceTuple
 * 
 */
@XmlRootElement(name = "user")
public class UserDTO implements Serializable {

  private static final long serialVersionUID = -338554341904678696L;

  private String name;

  private Set<String> joinedGroups;

  private Set<String> createdGroups;

  private Set<String> requestedGroups;

  private Set<PreferenceTuple> preferences;

  /**
   * Default class constructor
   */
  public UserDTO() {

  }

  /**
   * The constructor which sets the user name
   * 
   * @param username
   *          the user name
   */
  public UserDTO(String username) {

    this.name = username;
  }

  /**
   * Gets the user name
   * 
   * @return the user name
   */
  public String getName() {

    return name;
  }

  /**
   * Sets the user name
   * 
   * @param name
   *          the user name
   */
  public void setName(String name) {

    this.name = name;
  }

  /**
   * Gets the set of the names of the joined groups
   * 
   * @return the set of joined groups
   */
  public Set<String> getJoinedGroups() {

    return joinedGroups;
  }

  /**
   * Sets the joined groups
   * 
   * @param joinedGroups
   *          the set of names of the joined groups
   */
  public void setJoinedGroups(Set<String> joinedGroups) {

    this.joinedGroups = joinedGroups;
  }

  /**
   * Gets the set of names of groups created by this user
   * 
   * @return the set of created groups
   */
  public Set<String> getCreatedGroups() {

    return createdGroups;
  }

  /**
   * Sets the set of created groups
   * 
   * @param createdGroups
   *          the set of names of created groups
   */
  public void setCreatedGroups(Set<String> createdGroups) {

    this.createdGroups = createdGroups;
  }

  /**
   * Gets the set of names of requested groups
   * 
   * @return the set of requested groups
   */
  public Set<String> getRequestedGroups() {

    return requestedGroups;
  }

  /**
   * Sets the set of names of requested groups
   * 
   * @param requestedGroups
   *          the set of reqeusted groups
   */
  public void setRequestedGroups(Set<String> requestedGroups) {

    this.requestedGroups = requestedGroups;
  }

  /**
   * Gets the set of preferences
   * 
   * @return the set of preferences represented by PreferenceTuples
   * @see PreferenceTuple
   */
  public Set<PreferenceTuple> getPreferences() {

    return preferences;
  }

  /**
   * Sets the set of preferences represented by {@link PreferenceTuple}
   * 
   * @param preferences
   *          the set of {@link PreferenceTuple}
   * @see PreferenceTuple
   */
  public void setPreferences(Set<PreferenceTuple> preferences) {

    this.preferences = preferences;
  }

}
